import { Badge } from 'antd';
import React, { useEffect, useState } from 'react';
import { useAccess, useModel, history } from 'umi';
import TableInstruct from './table/TableInstruct';
import { parse } from '@/utils/historyUtils';
import { getToken, setToken } from '@/utils/token';
export default (): React.ReactNode => {
    const access = useAccess();

    const [tabActiveKey, setTabActiveKeyState] = useState<string>('all');
    useEffect(() => {
        const { token } = parse(location.search) as { token: string };
        if (token && token.length > 0) {
            setToken(token)
        }
    }, [])

    const renderBadge = (count: number, active = false) => {
        return (
            <Badge
                count={count}
                style={{
                    marginBlockStart: -2,
                    marginInlineStart: 4,
                    color: active ? '#1890FF' : '#999',
                    backgroundColor: active ? '#E6F7FF' : '#eee',
                }}
            />
        );
    };

    return (
        <TableInstruct brainType={tabActiveKey} />
    );
};
